package com.easy.service.impl;

import com.easy.bean.ClassificationBean;
import com.easy.bean.CommentBean;
import com.easy.bean.UserBean;
import com.easy.mapper.ClassificationDao;
import com.easy.service.ClassificationService;
import com.easy.util.LogMethod;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ClassificationServiceImpl implements ClassificationService {
    @Autowired
    private ClassificationDao clasDao;
    @Override
    @LogMethod(serviceName = "添加类型",recordReturn = true)
    public ClassificationBean add(ClassificationBean cla) {
        clasDao.add(cla);
        return clasDao.get(cla.getId());
    }

    @Override
    @LogMethod(serviceName = "类型删除",recordReturn = true)
    public int del(Integer id) {
        return clasDao.del(id);
    }

    @Override
    @LogMethod(serviceName = "类型修改",recordReturn = true)
    public ClassificationBean edit(ClassificationBean cla) {
        clasDao.edit(cla);
        return clasDao.get(cla.getId());
    }

    @Override
    public void page(Page page, ClassificationBean clas) {
        int count = clasDao.pageCount(clas);
        List<ClassificationBean> data = clasDao.page(page, clas);
        page.setCount(count);
        page.setData(data);
    }
    @Override
    public List<ClassificationBean> list(ClassificationBean cla) {
        return clasDao.list(cla);
    }


}
